home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LTP_PrintLabel.c < prev    next >
C/C++ Source or Header  |  1996-08-26  |  1KB  |  59 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. VOID
  15. LTP_PrintLabel(LayoutHandle *handle,ObjectNode *node,LONG left,LONG top)
  16. {
  17.     struct RastPort *rp;
  18.     STRPTR label;
  19.     LONG underscore;
  20.     LONG len;
  21.  
  22.     rp = &handle->RPort;
  23.  
  24.     LTP_SetPens(rp,node->HighLabel ? handle->DrawInfo->dri_Pens[HIGHLIGHTTEXTPEN] : handle->TextPen,0,JAM1);
  25.  
  26.     Move(rp,left - (node->LabelWidth + INTERWIDTH),top + rp->TxBaseline);
  27.  
  28.     label = node->Label;
  29.  
  30.     len = strlen(label);
  31.     underscore = 0;
  32.  
  33.     while(label[underscore] != '_' && underscore < len)
  34.         underscore++;
  35.  
  36.     if(underscore)
  37.         Text(rp,label,underscore);
  38.  
  39.     if(underscore < len - 1)
  40.     {
  41.         ULONG OldStyle;
  42.  
  43.         underscore += 2;
  44.         label += underscore;
  45.         len -= underscore;
  46.  
  47.         OldStyle = rp->AlgoStyle;
  48.  
  49.         SetSoftStyle(rp,FSF_UNDERLINED,FSF_UNDERLINED);
  50.  
  51.         Text(rp,label - 1,1);
  52.  
  53.         SetSoftStyle(rp,OldStyle,FSF_UNDERLINED);
  54.  
  55.         if(len)
  56.             Text(rp,label,len);
  57.     }
  58. }
  59.